﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iLangl.Transport.Communication;
using iLangl.Model;

namespace iLangl.Customer.Actions
{
	public class UpdateCompanyInfoAction : BaseCustomerAction
	{
		private ActionResult _actionResult = null;
		public ActionResult ActionResult
		{
			get
			{
				return _actionResult;
			}
		}

		public UpdateCompanyInfoAction(Company company)
			: base()
		{
			RequestContext = new CompanyRequestContext();
			RequestContext.SetContext(company);

			ActionResultResponseContext responsecontext = new ActionResultResponseContext();
			ResponseContext = responsecontext;
			responsecontext.ContextUpdated += new EventHandler(responsecontext_ContextUpdated);
		}

		void responsecontext_ContextUpdated(object sender, EventArgs e)
		{
			object result = ResponseContext.GetContext();

			if (result is ActionResult)
			{
				_actionResult = result as ActionResult;
			}

			weGetResult();	
		}

		protected override void _execute()
		{
		}

		protected override string GetName()
		{
			return "UpdateCompanyInfo";
		}

		protected override string GetVersion()
		{
			return "1";
		}

	}
}
